home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / DIALOG.PAK / GLOBALS.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  6KB  |  155 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12. //-------------------------------------------------------------------------
  13. // Functions for handling main window messages.  The message-dispatching
  14. // mechanism expects all message-handling functions to have the following
  15. // prototype:
  16. //
  17. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  18.  
  19. // **TODO**  Add message-handling function prototypes here.  Be sure to
  20. //           add the function names to the main window message table in
  21. //           dialog.c.
  22.  
  23. LRESULT MsgCommand(HWND, UINT, WPARAM, LPARAM);
  24. LRESULT MsgDestroy(HWND, UINT, WPARAM, LPARAM);
  25. LRESULT MsgPaint  (HWND, UINT, WPARAM, LPARAM);
  26.  
  27.  
  28. //-------------------------------------------------------------------------
  29. // Functions for handling main window commands--ie. functions for
  30. // processing WM_COMMAND messages based on the wParam value.
  31. // The message-dispatching mechanism expects all command-handling
  32. // functions to have the following prototype:
  33. //
  34. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  35.  
  36. // **TODO**  Add message-handling function prototypes here.  Be sure to
  37. //           add the function names to the main window command table in
  38. //           dialog.c.
  39.  
  40. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  41. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  42. LRESULT CmdModal(HWND, WORD, WORD, HWND);
  43. LRESULT CmdModeless(HWND, WORD, WORD, HWND);
  44.  
  45.  
  46. //-------------------------------------------------------------------------
  47. // Global function prototypes.
  48.  
  49. // **TODO**  Add global function prototypes here.
  50.  
  51. BOOL InitApplication(HINSTANCE);
  52. BOOL InitInstance(HINSTANCE, int);
  53. BOOL CenterWindow(HWND, HWND);
  54.  
  55.     // Callback functions.  These are called by Windows.
  56.  
  57. // **TODO**  Add new callback function prototypes here.  Win16 compiles
  58. //           require the __export keyword to generate proper prolog
  59. //           and epilog code for exported functions.
  60.  
  61. #ifdef WIN16
  62.  
  63. LRESULT CALLBACK __export WndProc(HWND, UINT, WPARAM, LPARAM);
  64.  
  65. #else
  66.  
  67. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  68.  
  69. #endif
  70.  
  71. //-------------------------------------------------------------------------
  72. // Global variable declarations.
  73.  
  74. extern HINSTANCE hInst;          // The current instance handle
  75. extern char      szAppName[];    // The name of this application
  76. extern char      szTitle[];      // The title bar text
  77.  
  78. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  79. //           line 2.  For MDI applications, uncomment line 2 below, comment
  80. //           line 1, and then define hwndMDIClient as a global variable in
  81. //           INIT.C
  82. #define hwndMDIClient NULL        /* (1) Stub for NON-MDI applications. */
  83. // extern HWND hwndMDIClient;     /* (2) For MDI applications.          */
  84.  
  85. extern HBRUSH hBkgndBrush;        // Handle for background brush
  86.  
  87. //-------------------------------------------------------------------------
  88. // Message and command dispatch infrastructure.  The following type
  89. // definitions and functions are used by the message and command dispatching
  90. // mechanism and do not need to be changed.
  91.  
  92.     // Function pointer prototype for message handling functions.
  93. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  94.  
  95.     // Function pointer prototype for command handling functions.
  96. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  97.  
  98.     // Enumerated type used to determine which default window procedure
  99.     // should be called by the message- and command-dispatching mechanism
  100.     // if a message or command is not handled explicitly.
  101. typedef enum
  102. {
  103.    edwpNone,            // Do not call any default procedure.
  104.    edwpWindow,          // Call DefWindowProc.
  105.    edwpDialog,          // Call DefDlgProc (This should be used only for
  106.                         // custom dialogs - standard dialog use edwpNone).
  107.    edwpMDIChild,        // Call DefMDIChildProc.
  108.    edwpMDIFrame         // Call DefFrameProc.
  109. } EDWP;                // Enumeration for Default Window Procedures
  110.  
  111.     // This structure maps messages to message handling functions.
  112. typedef struct _MSD
  113. {
  114.     UINT   uMessage;
  115.     PFNMSG pfnmsg;
  116. } MSD;                 // MeSsage Dispatch structure
  117.  
  118.     // This structure contains all of the information that a window
  119.     // procedure passes to DispMessage in order to define the message
  120.     // dispatching behavior for the window.
  121. typedef struct _MSDI
  122. {
  123.     int  cmsd;          // Number of message dispatch structs in rgmsd
  124.     MSD *rgmsd;         // Table of message dispatch structures
  125.     EDWP edwp;          // Type of default window handler needed.
  126. } MSDI, FAR *LPMSDI;   // MeSsage Dipatch Information
  127.  
  128.     // This structure maps command IDs to command handling functions.
  129. typedef struct _CMD
  130. {
  131.     WORD   wCommand;
  132.     PFNCMD pfncmd;
  133. } CMD;                 // CoMmand Dispatch structure
  134.  
  135.     // This structure contains all of the information that a command
  136.     // message procedure passes to DispCommand in order to define the
  137.     // command dispatching behavior for the window.
  138. typedef struct _CMDI
  139. {
  140.     int  ccmd;          // Number of command dispatch structs in rgcmd
  141.     CMD *rgcmd;         // Table of command dispatch structures
  142.     EDWP edwp;          // Type of default window handler needed.
  143. } CMDI, FAR *LPCMDI;   // CoMmand Dispatch Information
  144.  
  145.     // Message and command dispatching functions.  They look up messages
  146.     // and commands in the dispatch tables and call the appropriate handler
  147.     // function.
  148. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  149. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  150.  
  151.     // Message dispatch information for the main window
  152. extern MSDI msdiMain;
  153.     // Command dispatch information for the main window
  154. extern CMDI cmdiMain;
  155.